<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset=utf-8>
    <meta http-equiv=X-UA-Compatible content="IE=edge">
    <meta name=viewport
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0,shrink-to-fit=no">
    <meta name=format-detection content="telephone=no">
    <meta name=renderer content=webkit>
    <meta name=description content="">
    <meta name=keywords content="">
    <meta http-equiv=Cache-Control content="no-cache, no-store, must-revalidate">
    <meta http-equiv=Pragma content=no-cache>
    <meta http-equiv=Expires content=0>
    <meta name=renderer content=webkit>
    <meta name=mobile-web-app-capable content=yes>
    <meta name=apple-mobile-web-app-status-bar-style content=black>
    <meta name=apple-mobile-web-app-title content=创客匠人>
    <meta http-equiv=x-dns-prefetch-control content=on>
    <title>点金小票页面</title>
    <!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> -->
    <script type="text/javascript" charset="UTF-8" src="https://wx.gtimg.com/pay_h5/goldplan/js/jgoldplan-1.0.0.js"></script>
    <script src="https://assets.ckjr001.com/axios-v0.15.3.min.js"></script>
    <script>
      (function (doc, win) {
        //h5手机页面字体自适应
        var docEl = doc.documentElement,
          resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
          recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            if (clientWidth > 640) {
              clientWidth = 640;
            }
            docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
          };
        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
      })(document, window);
    </script>
    <style>
      body{
        padding: 0;
        margin: 0;
        font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
        font-weight: normal;
        color: #0a0a0a;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        background-color: #fff;
        overflow-x: hidden;
        box-sizing: border-box;
      }
      .c-flex-row{display:flex; display: -webkit-flex; flex-direction: row; -webkit-flex-direction: row;}
      .c-flex-column{display:flex;display: -webkit-flex;flex-direction: column; -webkit-flex-direction: column;}
      .c-alignc-center{align-content:center; -webkit-align-content:center;}
      .c-aligni-center{align-items:center; -webkit-align-items:center;}
      .c-alignc-sa{align-content:space-around; -webkit-align-content:space-around;}
      .c-flex-center{align-items:center; -webkit-align-items:center;justify-content:center; -webkit-justify-content:center;}
      .c-text-ellipsis1{text-overflow:ellipsis;white-space: nowrap; overflow: hidden;}
      .page {
        margin: 0 auto;
        max-width: 16rem;
        max-height: 24rem;
        min-height: 12.5rem;
      }
      .info {
        height: 2rem;
        opacity: 1;
        background: #fff1e5;
        font-size: 0.7rem;
        font-weight: 600;
        color: #fc583d;
        padding-left: 0.5rem;
      }
      .infoImg {
        width: 0.75rem;
        height: 0.75rem;
        margin-right: 0.25rem;
      }
      .content {
        margin-top: 2.8rem;
      }
      .paySuccess {
        font-size: 1rem;
        font-weight: 600;
        color: #000000;
      }
      .paySuccess>img {
        width: 1.2rem;
        height: 1,2rem;
        margin-right: 0.4rem;
      }
      .money {
        font-size: 0.8rem;
        font-weight: 400;
        color: #333333;
        margin-top: 0.8rem;
      }
      .button {
        width: 13rem;
        height: 2rem;
        line-height: 2rem;
        opacity: 1;
        background: #30b656;
        border-radius: 1.1rem;
        font-size: 0.8rem;
        text-align: center;
        color: #ffffff;
        margin-top: 2rem;
        position: relative;
      }
      .detail {
        margin-top: 1.55rem;
        background: url('https://ck-bkt-knowledge-payment.oss-cn-hangzhou.aliyuncs.com/admin/material/9_material_admin/image/assets/i/goldPlanBg.png') no-repeat center;
        background-size: 14rem 8.5rem;
        width: 14rem;
        height: 8.5rem;
        padding-top: 3rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        font-size: 0.65rem;
        box-sizing: border-box;
      }
      .c-mt24 {
        margin-top: 0.6rem;
      }
      /* .fingure {
        position: absolute;
        right: 0px;
        top: 0px;
      }
      .fingure>img {
        width: 3.9rem;
        height: 3.65rem;
        animation: fingerHandle 1s ease infinite both;
        -webkit-animation: fingerHandle 1s ease infinite both;
      }
      @keyframes fingerHandle {
        0% {
          transform: none;
        }
        70% {
          transform: scale3d(.8, .8, .8);
        }
        100% {
          transform: none;
        }
      }
      @-webkit-keyframes fingerHandle {
        0% {
          transform: none;
        }
        70% {
          transform: scale3d(.8, .8, .8);
        }
        100% {
          transform: none;
        }
      } */
    </style>
</head>

<body>
    <div class="page">
      <div class="info c-flex-row c-aligni-center">
        <img class="infoImg" src=""/>
        <span>请勿点击左上角关闭按钮，以免找不到入口</span>
      </div>
        <div class="content c-flex-column c-flex-center">
          <div class="paySuccess c-flex-row c-aligni-center">
            <img class="" id="logoImg" src=""/>
            <span class="">支付成功</span>
          </div>
          <div class="money" id="money">
            ¥00
          </div>
          <div class="button" onclick="clickDetail()">
            查看内容
            <!-- <div class="fingure"><img class="" src="https://ck-bkt-knowledge-payment.oss-cn-hangzhou.aliyuncs.com/admin/material/9_material_admin/image/assets/i/fingure.png"/></div> -->
          </div>
          <div class="detail c-flex-column" id="detailInfo">
            <span class="c-mt24">支付时间：<span id="time"></span></span>
            <span class="c-mt24 c-text-ellipsis1">订单编号：<span id="orderId"></span></span>
            <span class="c-mt24">订单状态：支付成功</span>
          </div>
        </div>
    </div>
    <script>
      var gourl = '';
      function clickDetail() {
        if (gourl != '') {
          var mchDataJ ={action: 'jumpOut', jumpOutUrl: gourl};
          var postDataJ = JSON.stringify(mchDataJ);
          parent.postMessage(postDataJ, 'https://payapp.weixin.qq.com');
        }
      }

      window.onload = function () {
        //获取url上带的参数
        var paramStrArr = window.location.href.split('?').length > 0 ? window.location.href.split('?')[1] : [];
        var paramArr = paramStrArr.length > 0 ? paramStrArr.split('&') : [];
        var paramObj = {};
        for (var i = 0; i < paramArr.length; i++) {
          let objArr = paramArr[i].split('=');
          paramObj[objArr[0]] = objArr.length > 1 ? objArr[1] : '';
        }
        if (paramObj.sub_mch_id && paramObj.out_trade_no) {
          if (paramObj.out_trade_no.indexOf("t100") > -1 && paramObj.out_trade_no.indexOf("t100") == 14) {
            var apiUrl = paramObj.sub_mch_id == 1612753706 || paramObj.sub_mch_id == 1612916032 || paramObj.sub_mch_id == 1676370980 ? 'https://kpapi-cs.ckjr001.com/api' : 'https://tkapi.ckjr001.com';
            axios.defaults.headers.common['from-app'] = 'wxapp';
            axios.defaults.headers.common['from-sub-app'] = 'wx-stand-h5';
            axios.defaults.headers.common['X-Requested-Version'] = 'feature/v202210-weh5'; //'20220825'
            axios.defaults.headers.common['versionno'] = '1.0'; //审核数据用，公众号这边不需要
            axios.post(apiUrl + '/ttapi/app/orders/goldPlan/getOrderInfo', {params: paramObj})
                .then(function (res) {
                  if (res.status == 200 && res.data.statusCode == 200) {
                    //处理业务逻辑 -- 封装链接地址
                    document.getElementById("money").innerHTML = "￥" + res.data.data.payMoney;
                    document.getElementById("orderId").innerHTML = res.data.data.orderNo;
                    document.getElementById("time").innerHTML = res.data.data.payTime;
                    /* if (res.data.data.logo) {
                      document.getElementById("logoImg").src = res.data.data.logo;
                    } */
                    gourl = res.data.data.url + '/tk/' + res.data.data.companyId + '/?#/?isFromWechatPay=1';
                    if (paramObj.sub_mch_id == 1612753706 || paramObj.sub_mch_id == 1612916032 || paramObj.sub_mch_id == 1676370980) {
                      gourl = res.data.data.url + '/tk/' + res.data.data.companyId + '/?t=' + (new Date()).getTime() + '#/?isFromWechatPay=1';
                    }
                  }
                })
                .catch(function (error) {
                  console.log(error);
                });
          } else {
            //测试环境点金计划商户号
            let testMchIdArr = ['1612753706','1612916032','1676370980','1669869577'];
            var apiUrl1 = testMchIdArr.includes(`${paramObj.sub_mch_id}`) ? 'https://kpapi-cs.ckjr001.com' : (paramObj.sub_mch_id == 1611318881 ? 'https://formalapi.ckjr001.com' : 'https://kpapiop.ckjr001.com');
            axios.get(apiUrl1 + '/api/goldPlan/getOrderInfo', {params: paramObj})
                .then(function (res) {
                  if (res.status == 200 && res.data.statusCode == 200) {
                    //处理业务逻辑 -- 封装链接地址
                    document.getElementById("money").innerHTML = "￥" + res.data.data.payMoney;
                    document.getElementById("orderId").innerHTML = res.data.data.orderNo;
                    document.getElementById("time").innerHTML = res.data.data.payAt;
                    /* if (res.data.data.logo) {
                      document.getElementById("logoImg").src = res.data.data.logo;
                    } */
                    gourl = "https://" + res.data.data.host + '/kpv2p/' + res.data.data.companyId + '/?#/?isFromWechatPay=1';
                    if (paramObj.sub_mch_id == 1612753706 || paramObj.sub_mch_id == 1612916032 || paramObj.sub_mch_id == 1676370980) {
                      gourl = "https://" + res.data.data.host + '/kpv2p/' + res.data.data.companyId + '/?t=' + (new Date()).getTime() + '#/?isFromWechatPay=1';
                    }
                  }
                })
                .catch(function (error) {
                  console.log(error);
                });
          }
        }
        var mchData ={action: 'onIframeReady', displayStyle: 'SHOW_CUSTOM_PAGE', height: 900};
        var postData = JSON.stringify(mchData);
        parent.postMessage(postData, 'https://payapp.weixin.qq.com');
      };
    </script>
</body>

</html>
